
package com.yunfei.api.product;

import com.yunfei.bo.product.ProductFileBo;
import com.yunfei.bo.result.ResultModel;
import com.yunfei.enums.ResultStatus;
import com.yunfei.mapper.aiiidb.ProdFileMapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Description: 产品附件
 * @Author: zhengyunfei
 * @Date: 2018/6/15
 * @time:11:26
 */
@SuppressWarnings("ALL")
@Api(value = "产品附件",tags = "产品附件")
@RestController
@RequestMapping("/api/product/detail/file")
public class ProductFileApiController {
    @Autowired
    private ProdFileMapper prodFileMapper;//产品附件
    /**
    * @Description: 理财师获取产品附件信息
    * @Author: zhengyunfei
    * @Date: 2019/1/11
    * @time:17:00
    */
    @GetMapping("/get")
    @ApiOperation(value = "理财师:产品附件",notes = "产品详情页面,产品附件",position = 1,response = Object.class)
    public Object get(String projId){
        ResultModel resultModel=new ResultModel();
        Map<String,Object> resultMap=new HashMap<>();
        Map<String,Object> queryMap=new HashMap<>();
        queryMap.put("projId",projId);
        List<ProductFileBo> productFileList= ( List<ProductFileBo> ) prodFileMapper.findProductFileList(queryMap);
        resultModel.setCode(ResultStatus.SUCCESS.getCode());
        resultModel.setMessage(ResultStatus.SUCCESS.getMessage());
        resultModel.setData(productFileList);
        return resultModel;
    }
    @GetMapping("/user/get")
    @ApiOperation(value = "客户:产品附件",notes = "产品详情页面,产品附件",position = 1,response = Object.class)
    public Object findProductFileListForUser(String projId){
        ResultModel resultModel=new ResultModel();
        Map<String,Object> resultMap=new HashMap<>();
        Map<String,Object> queryMap=new HashMap<>();
        queryMap.put("projId",projId);
        List<ProductFileBo> productFileList= ( List<ProductFileBo> ) prodFileMapper.findProductFileListForUser(queryMap);
        resultModel.setCode(ResultStatus.SUCCESS.getCode());
        resultModel.setMessage(ResultStatus.SUCCESS.getMessage());
        resultModel.setData(productFileList);
        return resultModel;
    }

}
